<?php
/**
 * @author Radovan Dvorsky
 * @version 20100604
 */
require_once ('Zend/Form.php');

class Form_Result_AddResult extends My_Form_AjaxForm {
	
	private $notes = array('A','B','C','D','E','F');
	
	public function __construct($url,$update,$format = 'html',$options = null) {
		parent::__construct ($options);
		
		$this->setJqueryParams(array(
				'url' => $url,
				'update' => $update,
				'format' => $format,
				'destroyDialog' => true,
			)
		);		
		
		$this->setMethod('POST');
		$this->addDecorator('Fieldset',array('legend' => 'Hodnotenie študenta'));
		
		$grade = new Zend_Form_Element_Select('grade');
		$grade->addFilters(array('StripTags','StringTrim'))
		->setAllowEmpty(false)
		->setRequired(true)
		->setLabel('Známka');
		$grade->addMultiOption(null,null);
		foreach ($this->notes as $note){
			$grade->addMultiOption($note,$note);
		}		
		
		$note = new Zend_Form_Element_Textarea('note');
		$note->addFilters(array('StripTags','StringTrim'))
		->setAllowEmpty(true)
		->setLabel('Poznámka');
		
		$submit = new Zend_Form_Element_Button('submitGrade');
		$submit->setLabel('Pridať');
		
		$this->addAjaxableElements(array($grade,$note));		
		$this->setSender($submit,'onClick');		
		$this->addElements(array($grade,$note,$submit));
	}
}